#include"redtree.h"

namespace my_map
{

	template<class K, class V>
	class map
	{
	public:
		struct K_of_T
		{
			const K& operator()(const pair<K, V>& kv)
			{
				return kv.first;
			}
		};
		typedef typename RBTree<K, K, K_of_T>::iterator iterator;
		iterator begin()
		{
			return _t.Begin();
		}

		iterator end()
		{
			return _t.End();
		}
		pair<iterator, bool>Insert(const pair<K, V>& kv)
		{
			_t.Insert(kv);
		}
	private:
		RBTree<K, pair<K, V>, K_of_T> _t;
	};
}
namespace my_set
{
	template<class K>
	class set
	{
	public:
		struct K_of_T
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
		typedef typename RBTree<K, K, K_of_T>::iterator iterator;

		iterator begin()
		{
			return _t.Begin();
		}

		iterator end()
		{
			return _t.End();
		}

		pair<iterator, bool>insert(const K& key)
		{
			return _t.insert(key);
		}
	private:
		RBTree<K, K, K_of_T> _t;
	};
}
int main()
{
	int a[] = { 2,123,21,32,453,123,43,12,321,13 };
	my_set::set<int> h1;
	for (auto e : a)
	{
		h1.insert(e);
	}
	for (auto e : h1)
	{
		cout << e << "  ";
	}
	return 0;
}